# Maintainer: Leonidas Spyropoulos <artafinde@archlinux.org>
# Contributor: Sergey Kostyuchenko <derfenix@gmail.com>

pkgname=corectrl
pkgver=1.3.5
pkgrel=2
_tag_head_commit=dd0b8ce1e43c30e014cbaf0590422132acc0ce31
pkgdesc="Core control application"
url="https://gitlab.com/corectrl/corectrl"
license=('GPL3')
arch=('loong64' 'x86_64')
depends=(procps-ng hwdata quazip-qt5 qt5-charts qt5-quickcontrols2 qt5-base
         botan2 qt5-svg qt5-xmlpatterns qt5-base dbus polkit fmt pugixml hicolor-icon-theme)
makedepends=(cmake qt5-tools extra-cmake-modules ninja easyloggingpp)
checkdepends=(catch2 trompeloeil)
optdepends=(
	'vulkan-tools: For vulkaninfo'
	'mesa-utils: For glxinfo'
	'util-linux: For lscpu'
)
source=("https://gitlab.com/corectrl/corectrl/-/archive/v${pkgver}/${pkgname}-v${pkgver}.tar.bz2")
sha256sums=('5e3b03b5103e4137af343f84b339edf1dcd37e78a56fb2bf0edc088f977a8a74')
b2sums=('4ee9ff0f84455599b9801d7e712ad98207462e573b3654f3dfa668b0691ef57a35482087ca193a985d241a10a3c9617e77ef5c1acdbbe9974b9d44fcdacd9295')

build() {
  cmake \
    -Bbuild \
    -GNinja \
    -S "${pkgname}-v${pkgver}" \
    -DCMAKE_BUILD_TYPE='None' \
    -DCMAKE_INSTALL_PREFIX='/usr' \
    -DCMAKE_INSTALL_LIBDIR='lib' \
    -DCMAKE_INSTALL_LIBEXECDIR='lib' \
    -DBUILD_TESTING=ON \
    -Wno-dev
  cmake --build build --verbose
}

check () {
  CTEST_OUTPUT_ON_FAILURE=1 ninja -C build test
}

package() {
  depends+=(
    fmt libfmt.so
  )
  DESTDIR="${pkgdir}" cmake --install build
}

# vim:set ts=2 sw=2 et:
